import java.util.*;

public class RepeatDNA {

    public static List<String> splitDNA(String DNA){
        int l=10;
        List<String> result=new ArrayList<>();
        int sl=DNA.length();
        Map<String,Integer> hashMap=new HashMap<>();
        for (int i = 0; i <=sl-l ; i++) {
            String child=DNA.substring(i,i+l);
            hashMap.put(child, hashMap.getOrDefault(child, 0) + 1);
            if (hashMap.get(child) == 2) {
                result.add(child);
            }

        }
        return result;

    }

    public static void main(String[] args) {
        String s="AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT";
        List<String> strings = splitDNA(s);
       strings.forEach(i-> System.out.println(i));
    }



}
